<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Zapatec Utils Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="zpdebug.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b>Zapatec Utils</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>zpdebug.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		Zapatec Debug.

 <pre>
 Copyright (c) 2004-2009 by Zapatec, Inc.
 http://www.zapatec.com
 1700 MLK Way, Berkeley, California,
 94709, U.S.A.
 All rights reserved.
 </pre><BR/><BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="Zapatec/Debug.html">Zapatec.Debug</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/**
 * <span class="attrib">@fileoverview</span> Zapatec Debug.
 *
 * &lt;pre&gt;
 * Copyright (c) 2004-2009 by Zapatec, Inc.
 * http://www.zapatec.com
 * 1700 MLK Way, Berkeley, California,
 * 94709, U.S.A.
 * All rights reserved.
 * &lt;/pre&gt;
 */</span>

<span class="comment">/* $Id: zpdebug.js 15736 2009-02-06 15:29:25Z nikolai $ */</span>

<span class="reserved">if</span> (typeof zapatecDebug == <span class="literal">'undefined'</span>) {

<span class="reserved">if</span> (typeof Zapatec == <span class="literal">'undefined'</span>) {
	<span class="comment">/**
	 * <span class="attrib">@ignore</span> Namespace definition.
	 */</span>
	Zapatec = <span class="reserved">function</span>() {};
}

<span class="comment">/**
 * Zapatec Debug class.
 *
 * <span class="attrib">@constructor</span>
 * <span class="attrib">@param</span> {function} fLogger Optional logger callback; default
 * {<span class="attrib">@link</span> Zapatec.Debug#popupLogger}
 */</span>
zapatecDebug =
Zapatec.Debug = <span class="reserved">function</span> (fLogger) {
	<span class="reserved">if</span> (typeof fLogger == <span class="literal">'function'</span>) {
		<span class="reserved">this</span>.logger = fLogger;
	} <span class="reserved">else</span> {
		<span class="reserved">this</span>.logger = zapatecDebug.popupLogger;
	}
};

<span class="comment">/**
 * Displays message.
 *
 * <span class="attrib">@param</span> {string} sMsg Message
 * <span class="attrib">@param</span> {string} sLevel Optional message prefix
 */</span>
Zapatec.Debug.<span class="reserved">prototype</span>.out = <span class="reserved">function</span>() { 
	<span class="reserved">this</span>.logger.apply(<span class="reserved">this</span>, arguments); 
};

<span class="comment">/**
 * Displays "DEBUG" message.
 *
 * <span class="attrib">@param</span> {string} sMsg Message
 */</span>
Zapatec.Debug.<span class="reserved">prototype</span>.debug = <span class="reserved">function</span>(sMsg) {
	<span class="reserved">this</span>.out(sMsg, <span class="literal">'DEBUG'</span>);
};

<span class="comment">/**
 * Displays "WARN" message.
 *
 * <span class="attrib">@param</span> {string} sMsg Message
 */</span>
Zapatec.Debug.<span class="reserved">prototype</span>.warn = <span class="reserved">function</span>(sMsg) {
	<span class="reserved">this</span>.out(sMsg, <span class="literal">'WARN'</span>);
};

<span class="comment">/**
 * Displays "ERROR" message.
 *
 * <span class="attrib">@param</span> {string} sMsg Message
 */</span>
Zapatec.Debug.<span class="reserved">prototype</span>.error = <span class="reserved">function</span>(sMsg) {
	<span class="reserved">this</span>.out(sMsg, <span class="literal">'ERROR'</span>);
};

<span class="comment">/**
 * Dumps JSON object.
 *
 * <span class="attrib">@param</span> {object} oObj JSON object
 */</span>
Zapatec.Debug.<span class="reserved">prototype</span>.json = <span class="reserved">function</span>(oObj) {
	<span class="reserved">if</span> (typeof zapatecTransport != <span class="literal">'undefined'</span>) {
		<span class="comment">// Allow functions</span>
		<span class="reserved">this</span>.out(zapatecTransport.serializeJsonObj(oObj, true));
	}
};

<span class="comment">/**
 * Logger callback. Writes messages to popup window. Must be called in scope of
 * {<span class="attrib">@link</span> Zapatec#Debug} instance.
 *
 * <span class="attrib">@param</span> {string} sMsg Message
 * <span class="attrib">@param</span> {string} sLevel Optional message prefix
 */</span>
Zapatec.Debug.popupLogger = <span class="reserved">function</span>(sMsg, sLevel) {
	var oPopup = <span class="reserved">this</span>.popup;
	<span class="reserved">if</span> (!oPopup || !oPopup.document) {
		oPopup = <span class="reserved">this</span>.popup = window.open(<span class="literal">''</span>, <span class="literal">'zapatecDebug'</span>);
		<span class="reserved">if</span> (!oPopup) {
			<span class="reserved">return</span>;
		}
	}
	var oDoc = oPopup.document;
	var oTable = oDoc.getElementById(<span class="literal">'zpDebugTable'</span>);
	<span class="reserved">if</span> (!oTable) {
		oDoc.writeln(
			<span class="literal">'&lt;table width="100%" id="zpDebugTable"&gt;&lt;tr&gt;&lt;th align="left" colspan="2"&gt;Time&lt;/th&gt;&lt;th align="left"&gt;Message&lt;/th&gt;&lt;/tr&gt;&lt;/table&gt;'</span>
		);
		oDoc.close();
		oTable = oDoc.getElementById(<span class="literal">'zpDebugTable'</span>);
	}
	var oRow = oTable.insertRow(1);
	var oCell1 = oRow.insertCell(-1);
	var oCell2;
	<span class="reserved">if</span> (sLevel) {
		oCell2 = oRow.insertCell(-1);
	} <span class="reserved">else</span> {
		oCell1.setAttribute(<span class="literal">'colspan'</span>, 2);
	}
	var oCell3 = oRow.insertCell(-1);
	var oStyle1 = oCell1.style;
	oStyle1.fontSize = <span class="literal">'70%'</span>;
	oStyle1.width = <span class="literal">'1%'</span>;
	oStyle1.whiteSpace = <span class="literal">'nowrap'</span>;
	var oStyle2;
	<span class="reserved">if</span> (oCell2) {
		oStyle2 = oCell2.style;
		oStyle2.fontSize = <span class="literal">'70%'</span>;
		oStyle2.width = <span class="literal">'1%'</span>;
		oStyle2.whiteSpace = <span class="literal">'nowrap'</span>;
	}
	var oStyle3 = oCell3.style;
	oStyle3.fontSize = <span class="literal">'70%'</span>;
	<span class="reserved">if</span> (oTable.rows.length % 2 == 0) {
		oStyle1.backgroundColor = <span class="literal">'#EEE'</span>;
		<span class="reserved">if</span> (oStyle2) {
			oStyle2.backgroundColor = <span class="literal">'#EEE'</span>;
		}
		oStyle3.backgroundColor = <span class="literal">'#EEE'</span>;
	}
	var oNow = new Date();
	var sHours = oNow.getHours();
	var sMinutes = oNow.getMinutes();
	<span class="reserved">if</span> (sMinutes &lt; 10) {
		sMinutes = <span class="literal">'0'</span> + sMinutes;
	}
	var sSeconds = oNow.getSeconds();
	<span class="reserved">if</span> (sSeconds &lt; 10) {
		sSeconds = <span class="literal">'0'</span> + sSeconds;
	}
	oCell1.innerHTML = sHours + <span class="literal">':'</span> + sMinutes + <span class="literal">':'</span> + sSeconds;
	<span class="reserved">if</span> (oCell2) {
		oCell2.innerHTML = sLevel;
	}
	oCell3.innerHTML = sMsg;
};

<span class="comment">/**
 * Logger callback. Writes messages to console or popup window. Must be called
 * in scope of {<span class="attrib">@link</span> Zapatec#Debug} instance.
 *
 * <span class="attrib">@param</span> {string} sMsg Message
 * <span class="attrib">@param</span> {string} sLevel Optional message prefix
 */</span>
Zapatec.Debug.consoleLogger = <span class="reserved">function</span>(sMsg, sLevel) {
	<span class="reserved">if</span> (window.console) {
		<span class="reserved">if</span> (sLevel) {
			sLevel += <span class="literal">': '</span>;
		}
		window.console.log(sLevel + sMsg);
	} <span class="reserved">else</span> {
		zapatecDebug.popupLogger.apply(<span class="reserved">this</span>, arguments);
	}
};

<span class="comment">/**
 * Zapatec Debug instance. Use to output error messages.
 * <span class="attrib">@final</span>
 */</span>
Zapatec.Debug.log = new zapatecDebug();

<span class="comment">/**
 * Zapatec Debug instance. Use to output error messages.
 * <span class="attrib">@private</span>
 * <span class="attrib">@final</span>
 */</span>
zpLog = zapatecDebug.log;

}
</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b>Zapatec Utils</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu May 21 12:19:24 2009</div>
</body>
</html>
